import { NextResponse } from "next/server";
import contactModule from "@/modules/contact";

export async function GET(request) {
  const codeMap = {0: '信息查询成功', 1: '信息查询失败'}
  const id = request.nextUrl.searchParams.get("id");
  let data = await contactModule.get(id);
  if (!data || data.length === 0) { return NextResponse.json({ code: 1, message: "No information found", codeMap, data: null }, { status: 404 });}
  return NextResponse.json({ code: 0, message: "Success", type: "contact", codeMap, data: data })
}